package com.item.piketao.api;

import com.item.piketao.bo.SpuBo;
import com.item.piketao.dao.Sku;
import com.item.piketao.dao.SpuDetail;
import com.piketao.common.pojo.PageInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author: xinglongge
 * @Date: 2020/3/9 16 32
 * @Description:
 */
public interface GoodsApi {

    /**
     * 根据spuId查询spuDetail
     *
     * @param id
     * @return
     */
    @GetMapping("/spu/detail/{spuId}")
    SpuDetail querySpuDetailById(@PathVariable("spuId") Long id);

    /**
     * 根据条件分页查询spu
     *
     * @param key
     * @param saleable
     * @param page
     * @param rows
     * @return
     */
    @GetMapping("spu/page")
    PageInfo<SpuBo> querySpuByPage(
            @RequestParam(value = "key", required = false) String key,
            @RequestParam(value = "saleable", required = false) Boolean saleable,
            @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @RequestParam(value = "rows", required = false, defaultValue = "6") Integer rows
    );
    /**
     *通过spuId查询skus
     * @param id
     * @return
     */
    @GetMapping("sku/list")
    List<Sku> querySkuBySpuId(@RequestParam("id") Long id);
}
